package com.example.bean;

import com.example.bean.Component.Component;
import com.example.bean.Configuration.Configuration;
import com.example.bean.Controll.UserControll;
import com.example.bean.Service.Service;
import lombok.val;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class BeanApplication {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(BeanApplication.class, args);

//        UserControll userControll1 = context.getBean(UserControll.class);       //根据bean类型获取bean
//        userControll1.sayHi();

//        UserInfo userInfo1 = (UserInfo) context.getBean("u1");
//        UserInfo userInfo2 = (UserInfo) context.getBean("u2");
//        System.out.println(userInfo1);
//        System.out.println(userInfo2);

//        UserControll userControll2 = (UserControll) context.getBean("userControll"); //根据bean名称获取bean
//        userControll2.sayHi();
//
//        UserControll userControll3 = context.getBean("userControll",UserControll.class);//根据bean名称和类型来获取bean
//        userControll3.sayHi();

//        UserControll user = context.getBean(UserControll.class);
//        user.sayHi();


//



//
//        Configuration configuration = context.getBean("configuration",Configuration.class);
//        configuration.sayHi();
//
//        Component component = context.getBean(Component.class);
//        component.sayHi();











    }

}
